package com.chuanke.ckfamily.service.common;

import com.alibaba.fastjson.JSONObject;
import com.chuanke.ckfamily.dao.social.model.Family;
import com.chuanke.ckfamily.dao.social.model.FamilyMember;
import com.chuanke.ckfamily.dao.user.model.User;
import com.chuanke.ckfamily.service.exception.CFException;
import com.chuanke.ckfamily.service.exception.WyException;

import java.io.IOException;
import java.util.List;

public interface WyService {

    /**
     * 注册用户
     *
     * @param user
     */
    String registUser(User user) throws CFException;

    /**
     * 刷新用户
     *
     * @param user
     * @return
     */
    String refreshToken(User user) throws CFException;

    /**
     * 创建家族
     *
     * @param family
     * @return
     */
    String createTeam(Family family) throws IOException, WyException;

    /**
   	 * 修改群资料
	 * @param family
     * @param announcement 
     * @param familyName 
     * @param icon 
	 * @throws CFException
     * @throws CFException 
     */
    void updateTeam(Family family, String icon, String familyName, String announcement) throws CFException;

    /**
     * 解散家族
     *
     * @param tid
     */
    void removeTeam(String tid, String ownerNo) throws CFException;

    /**
     * 添加家族成员
     *
     * @param family
     * @param uno
     */
    void addTeamMember(Family family, String uno) throws CFException;

    /**
     * 增加一组用户
     *
     * @param family
     * @param userList
     * @return
     */
    void addTeamMembers(Family family, List<String> userList) throws CFException;

    /**
     * 踢人出家族
     *
     * @param tid
     * @param uno
     * @return
     */
    void removeTeamMember(String tid, String owner, String uno) throws CFException;

    /**
     * 退出家族
     *
     * @param tid
     * @param uno
     * @return
     */
    void leaveTeam(String tid, String uno) throws CFException;

    /**
     * 禁言用户
     *
     * @param tid
     * @param ownerNo
     * @param memberNo
     * @return
     */
    void muteTeamMember(String tid, String ownerNo, String memberNo, int mute) throws CFException;

    /**
     * 判断用户是否在指定群成员中，不存在则加入群
     *
     * @param family
     * @param familyMember 
     * @param userNo
     *
     * @return
     */
	void checkTeamMember(Family family, FamilyMember familyMember, String userNo);

	/**
	 * 群消息免打扰
	 * @param tid 
	 * @param userNo
	 * @param nocall 1：关闭消息提醒，2：打开消息提醒，其他值无效
	 * @return
	 */
	void muteTeam(String tid, String userNo, int nocall) throws CFException;

	/**
	 * 推送红包消息
	 * @param userNo 群成员 accid
	 * @param tid  群号
	 * @param content 消息内容
	 * @return
	 */
	void sendMsgForHongBao(String userNo, String tid, JSONObject content) throws CFException;
	/**
	 * 设置黑名单/静音
	 * @param userNo
	 * @param targetUserNo
	 * @param relationType
	 * @param value
	 * @throws CFException
	 */
	void setSpecialRelation(String userNo, String targetUserNo, int relationType,int value) throws CFException;
	/**
	 * 给指定群推送消息
	 * @param ext
	 * @throws CFException
	 */
	void pushMessageForTeam(String from, String to, String content,JSONObject ext) throws CFException;
	/**
	 * 给指定用户推送消息
	 * @param ext
	 * @throws CFException
	 */
	void pushMessageForUser(String userNo, String content, JSONObject ext)throws CFException;
	/**
	 * 给群推送普通消息
	 * @param from
	 * @param to
	 * @param content
	 * @param ext
	 * @throws CFException
	 */
	void sendMsgForTeam(String from, String to, String content, JSONObject ext)throws CFException;

	/**
	 * 给群推送消息 但是可以取消通知
	 * @param from
	 * @param to
	 * @param content
	 * @param ext
	 * @param push 传false 取消通知
	 * @throws CFException
	 */
	void sendMsgForTeam(String from, String to, String content, JSONObject ext, Boolean push)throws CFException;

	/**
	 * 
	 * 更新用户资料
	 * @param user
	 * @throws CFException
	 */
	void updateUser(User user) throws CFException;
	/**
	 * 更新好友相关信息
	 * @param user_no
	 * @param target_user_no
	 * @param alias
	 * @param json 
	 * @throws CFException
	 */
	void updateFriend(String user_no, String target_user_no, String alias, JSONObject json) throws CFException;
	/**
	 * 加好友
	 * @param user_no
	 * @param target_user_no
	 * @throws CFException
	 */
	void addFriend(String user_no, String target_user_no) throws CFException;
	/**
	 * 删除好友
	 * @param user_no
	 * @param target_user_no
	 * @throws CFException
	 */
	void deleteFriend(String user_no, String target_user_no);


	void updateRelationExpand(String userNo, String tuserNo) throws CFException;

	void sendUpdateFriend(String userNo) throws CFException;

	void sendMsgForUser(String form, String to, Integer type, String content,JSONObject ext) throws CFException;

	void sayHello(User user, User tuser, String hi) throws CFException;

	boolean changeOwner(String tid, String owner_user_no, String user_no);


	/**
	 * 申请好友推送系统通知
	 */
	void sendVideoMsgForUser(User form, User to) throws CFException;

	void shieldFamily(Family family, String user_no,Integer shield) throws CFException;

}
